import sun.reflect.generics.tree.ArrayTypeSignature;

import java.util.Arrays;
import java.util.Scanner;
public class Fill {
    public static void main(String[] args) {
        int[]arr={1,2,3,4,5};
        System.out.println("原数组为："+ Arrays.toString(arr));
        System.out.println("请输入要替换成什么元素：");
        Scanner sc=new Scanner(System.in);
        int data=sc.nextInt();
        System.out.println("请输入开始替换的下标：");
        int fromindex=sc.nextInt();
        System.out.println("请输入从下标开始替换的长度：");
        int toindex=sc.nextInt();
        Arrays.fill(arr,fromindex,toindex,data);
        System.out.println(Arrays.toString(arr));
    }
}
